package model

import "go-devops/common"

type MsgData struct {
	MsgType string      `json:"type"`
	Msg     string      `json:"msg"`
	Data    interface{} `json:"data"`
	Time    string      `json:"time"`
}

const (
	INFO    = "INFO"
	ERROR   = "ERROR"
	SUCCESS = "SUCCESS"
	NODE    = "NODE"
	FLOW    = "FLOW"
)

func MsgBuild(msgType string, time bool, msg string) *MsgData {
	data := &MsgData{
		MsgType: msgType,
		Msg:     msg,
	}
	if time {
		data.Time = common.NowStr()
	}
	return data
}
